﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="ControlStyles"
                    xmlns:src ="clr-namespace:BugLister">
    
    <Style TargetType="{x:Type Button}">
        <Setter Property="Height" Value="32" />
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Margin" Value="1" />
    </Style>
    <Style TargetType="{x:Type ToggleButton}">
        <Setter Property="Height" Value="32" />
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Margin" Value="1" />
    </Style>
    <Style TargetType="{x:Type ListBoxItem}">
        <!--ListBoxItem Template -->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <ControlTemplate.Resources>
                        <src:ImportanceColorConverter x:Key="colorConverter" />
                        <src:FixedColorConverter x:Key="fixedConverter" />
                    </ControlTemplate.Resources>
                    <Grid Background="{Binding Path=Importance, Converter={StaticResource ResourceKey=colorConverter}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid Background="{Binding Path=Fixed, Converter={StaticResource ResourceKey=fixedConverter}}"/>
                        <StackPanel Orientation="Horizontal" Margin="2" Grid.Column="1">
                            <Label Content="{Binding Path=ShortDescription}" />
                        </StackPanel>
                        <Line Grid.Column="2" />
                        <Label Grid.Column="3" Content="{Binding Path=DateAdded}" />
                    </Grid>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Margin" Value="10,0,0,0" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="FontWeight" Value="UltraBold" />
                            <Setter Property="BorderThickness" Value="2" />
                            <Setter Property="Opacity" Value="0.85" />
                            <Setter Property="Margin" Value="5,0,0,0"  />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <!--ListBoxItem Template - End-->
    </Style>
    <Style TargetType="ListBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Border 
                          BorderThickness="1"
                          CornerRadius="5">
                        <ScrollViewer 
                            Margin="0"
                            Focusable="false">
                            <StackPanel>
                                <StackPanel Margin="2" IsItemsHost="True" />
                            </StackPanel>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="ComboBox">
        <Setter Property="Height" Value="20" />
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Margin" Value="1" />
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="SelectedItem"
                           Value="{x:Null}" />
                    <Condition Property="HasItems"
                           Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="SelectedIndex"
                    Value="0" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>